<template>
  <div class="grandson">
    孙组件:{{ car.name }}+{{ car.price }}
  </div>
</template>

<script>
import { inject } from 'vue';

export default {
    name:'Grandson',
    setup(){
        let car = inject('car')
        console.log(car)
        let name = inject('name')
        console.log(name)
        return {
            car
        }
    }
}
</script>

<style>
    .grandson {
        padding: 10px;
        background-color: green;
    }
</style>